package com.study.skywalking.web;

import com.study.skywalking.dto.MyRestDTO;
import com.study.skywalking.dto.MyServerDTO;
import com.study.skywalking.service.IMyService;
import com.study.skywalking.vo.MyServerVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by zhangbo on 2020/6/8.
 */
@Slf4j
@RestController
public class MyController {

    @Autowired
    private IMyService myService;

    @GetMapping("/rest")
    public Object rest(MyServerVO restVO) {
        MyRestDTO rest = myService.rest(restVO);
        return rest;
    }


    @GetMapping("/myserver")
    public Object myServer() {
        log.info("myserver方法调用");
        MyServerDTO myServerDTO = myService.myServer();
        log.info("返回参数：{}", myServerDTO);
        return myServerDTO;
    }

    @GetMapping("/exception")
    public Object exception() {
        log.info("测试异常");
        return myService.testException();
    }

    @GetMapping("/message")
    public Object message() {
        return myService.sendMessage();
    }

    @GetMapping("/redis")
    public Object testRedis() {
        log.info("redis测试");
        return myService.testRedis();
    }

    @GetMapping("/noskywalking")
    public Object noskywalking() {
        return "noskywalking";
    }

    @GetMapping("/noskywalking1")
    public Object noskywalking1() {
        return "noskywalking1";
    }

    @GetMapping("/noskywalking/2")
    public Object noskywalking2() {
        return "noskywalking2";
    }

    @GetMapping("/unsend/test")
    public Object unsend() {
        return "unsend";
    }
}
